package com.adou.d5;

public class Test1 {
    public static void main(String[] args) {
        // 机票价格
        System.out.println(calcu( 1000,  8,  "经济舱"));
    }

    // 计算机票价格
    public static double calcu(double price, int month, String type) {
        if(month >=5 && month<=10) {
            // 旺季
            switch (type){
                case "头等舱":
                    price *=0.9;
                    break;
                case "经济舱":
                    price *=0.85;
                    break;
            }

        } else {
            // 淡季
            switch (type){
                case "头等舱":
                    price *=0.7;
                    break;
                case "经济舱":
                    price *=0.65;
                    break;
            }
        }
        return price;
    }
}
